const { addCommand } = require('redis');
const {daouser,daotittlechildsort,tittlefathersort}= require('../../dao/daoenter.js');




//查询所有题库分类
const cfindallques =async (req,res)=>{

	try{
		let hahares=await tittlefathersort.dfindallsort()
		res.send(hahares)
	}catch{
		res.send('查询错误',err)
	}
}


/* 添加1级分类 */
const csort =async(req,res)=>{
	if(JSON.stringify(req.body)!==''){
		let postdate={}
		postdate['uid']=req.body.uid
		postdate['sortfather']=req.body.sortfather
		try{
			let rs=await tittlefathersort.dsort(postdate)
			if (rs){
				res.send({"status":"1","describe":"保存成功"})
			  }
			}catch{
			res.send({"status":"0","describe":"保存失败"})
			}
	}else{
		res.send('error数据空')
	}
}




module.exports={
	cfindallques,csort
}
